/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ar.com.s21.poo.view;

/**
 *
 * @author Other
 */
public class PantallaMenu extends javax.swing.JFrame {

    /**
     * Creates new form PantallaMenu
     */
    public PantallaMenu(String tipoUsuario) {
        initComponents();
        habilitarOpcionesMenu(tipoUsuario);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        menuGeneral = new javax.swing.JMenuBar();
        menuUsuario = new javax.swing.JMenu();
        itemUsuarioNuevo = new javax.swing.JMenuItem();
        itemUsuarioConsultar = new javax.swing.JMenuItem();
        itemUsuarioCambiarPass = new javax.swing.JMenuItem();
        menuProducto = new javax.swing.JMenu();
        itemProductoNuevo = new javax.swing.JMenuItem();
        itemProductoConsultar = new javax.swing.JMenuItem();
        menuVenta = new javax.swing.JMenu();
        itemVentaNueva = new javax.swing.JMenuItem();
        itemVentaConsultar = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        itemConsultaProdFaltante = new javax.swing.JMenuItem();
        menuUsuario1 = new javax.swing.JMenu();
        itemAyudaAcerca = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        menuUsuario.setText("Usuario");

        itemUsuarioNuevo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        itemUsuarioNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/com/s21/poo/resources/img/addUser.jpg"))); // NOI18N
        itemUsuarioNuevo.setText("Nuevo...");
        itemUsuarioNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemUsuarioNuevoActionPerformed(evt);
            }
        });
        menuUsuario.add(itemUsuarioNuevo);

        itemUsuarioConsultar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        itemUsuarioConsultar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/com/s21/poo/resources/img/consultar.jpg"))); // NOI18N
        itemUsuarioConsultar.setText("Consultar...");
        itemUsuarioConsultar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemUsuarioConsultarActionPerformed(evt);
            }
        });
        menuUsuario.add(itemUsuarioConsultar);

        itemUsuarioCambiarPass.setText("Cambiar Password");
        itemUsuarioCambiarPass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemUsuarioCambiarPassActionPerformed(evt);
            }
        });
        menuUsuario.add(itemUsuarioCambiarPass);

        menuGeneral.add(menuUsuario);

        menuProducto.setText("Producto");

        itemProductoNuevo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
        itemProductoNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/com/s21/poo/resources/img/addProduct.jpg"))); // NOI18N
        itemProductoNuevo.setText("Nuevo...");
        itemProductoNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemProductoNuevoActionPerformed(evt);
            }
        });
        menuProducto.add(itemProductoNuevo);

        itemProductoConsultar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_J, java.awt.event.InputEvent.CTRL_MASK));
        itemProductoConsultar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/com/s21/poo/resources/img/consultar.jpg"))); // NOI18N
        itemProductoConsultar.setText("Consultar..");
        itemProductoConsultar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemProductoConsultarActionPerformed(evt);
            }
        });
        menuProducto.add(itemProductoConsultar);

        menuGeneral.add(menuProducto);

        menuVenta.setText("Venta");

        itemVentaNueva.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        itemVentaNueva.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/com/s21/poo/resources/img/addProduct.jpg"))); // NOI18N
        itemVentaNueva.setText("Nuevo...");
        itemVentaNueva.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemVentaNuevaActionPerformed(evt);
            }
        });
        menuVenta.add(itemVentaNueva);

        itemVentaConsultar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK));
        itemVentaConsultar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/com/s21/poo/resources/img/consultar.jpg"))); // NOI18N
        itemVentaConsultar.setText("Consultar...");
        menuVenta.add(itemVentaConsultar);

        menuGeneral.add(menuVenta);

        jMenu1.setText("Consultas");

        itemConsultaProdFaltante.setText("Productos Faltantes");
        itemConsultaProdFaltante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemConsultaProdFaltanteActionPerformed(evt);
            }
        });
        jMenu1.add(itemConsultaProdFaltante);

        menuGeneral.add(jMenu1);

        menuUsuario1.setText("Ayuda");
        menuUsuario1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuUsuario1ActionPerformed(evt);
            }
        });

        itemAyudaAcerca.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
        itemAyudaAcerca.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/com/s21/poo/resources/img/help.jpg"))); // NOI18N
        itemAyudaAcerca.setText("Acerca de..");
        itemAyudaAcerca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemAyudaAcercaActionPerformed(evt);
            }
        });
        menuUsuario1.add(itemAyudaAcerca);

        menuGeneral.add(menuUsuario1);

        setJMenuBar(menuGeneral);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 279, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void itemUsuarioNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemUsuarioNuevoActionPerformed
        new PantallaAltaUsuario(this, true).setVisible(true);
//        JOptionPane.showOptionDialog(this, new ProductoPanel(),"titulo", JOptionPane.NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null);
    }//GEN-LAST:event_itemUsuarioNuevoActionPerformed

    private void itemProductoNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemProductoNuevoActionPerformed
     new PantallaNuevoProducto(this, true).setVisible(true);
    }//GEN-LAST:event_itemProductoNuevoActionPerformed

    private void itemVentaNuevaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemVentaNuevaActionPerformed
      new PantallaVenta(this, rootPaneCheckingEnabled).setVisible(true);
    }//GEN-LAST:event_itemVentaNuevaActionPerformed

    private void itemAyudaAcercaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemAyudaAcercaActionPerformed
     new PantallaAcercaDe(this, true).setVisible(true);
    }//GEN-LAST:event_itemAyudaAcercaActionPerformed

    private void menuUsuario1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuUsuario1ActionPerformed
    
    }//GEN-LAST:event_menuUsuario1ActionPerformed

    private void itemUsuarioConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemUsuarioConsultarActionPerformed
            new PantallaConsultaUsuario(this, rootPaneCheckingEnabled).setVisible(true);
    }//GEN-LAST:event_itemUsuarioConsultarActionPerformed

    private void itemUsuarioCambiarPassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemUsuarioCambiarPassActionPerformed
                new PantallaCambiarPassword(this, rootPaneCheckingEnabled).setVisible(true);
    }//GEN-LAST:event_itemUsuarioCambiarPassActionPerformed

    private void itemProductoConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemProductoConsultarActionPerformed
                new PantallaConsultaProducto(this, rootPaneCheckingEnabled).setVisible(true);
    }//GEN-LAST:event_itemProductoConsultarActionPerformed

    private void itemConsultaProdFaltanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemConsultaProdFaltanteActionPerformed
        new PantallaProductosFaltantes(this, rootPaneCheckingEnabled).setVisible(true);
    }//GEN-LAST:event_itemConsultaProdFaltanteActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(PantallaMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(PantallaMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(PantallaMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(PantallaMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new PantallaMenu("administrador").setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem itemAyudaAcerca;
    private javax.swing.JMenuItem itemConsultaProdFaltante;
    private javax.swing.JMenuItem itemProductoConsultar;
    private javax.swing.JMenuItem itemProductoNuevo;
    private javax.swing.JMenuItem itemUsuarioCambiarPass;
    private javax.swing.JMenuItem itemUsuarioConsultar;
    private javax.swing.JMenuItem itemUsuarioNuevo;
    private javax.swing.JMenuItem itemVentaConsultar;
    private javax.swing.JMenuItem itemVentaNueva;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar menuGeneral;
    private javax.swing.JMenu menuProducto;
    private javax.swing.JMenu menuUsuario;
    private javax.swing.JMenu menuUsuario1;
    private javax.swing.JMenu menuVenta;
    // End of variables declaration//GEN-END:variables

    private void habilitarOpcionesMenu(String tipoUsuario) {
        switch(tipoUsuario.toLowerCase()){
                    case "administrador": 
                        break;
                    case "cliente":
                        itemUsuarioNuevo.setVisible(false);
                        itemUsuarioConsultar.setVisible(false);
                        itemProductoNuevo.setVisible(false);
                        itemConsultaProdFaltante.setVisible(false);
                        break;
                    case "vendedor": 
                        itemUsuarioNuevo.setVisible(false);
                        itemVentaConsultar.setVisible(false);
                        break;
                }
    }
}
